#bilibili排名算法 v2.8(2012.1.6)
class Results::R28 < Results::R27
  def self.get_comment_revised clicks, comments, stows, ops={}
    return E_C if comments <= 0
    if ops[:hot_bangumi]
      [format("%.2f", E_C.to_f * ([clicks * 1.5, 50000].min) / (clicks.to_f + comments.to_f * E_C)).to_f,
       E_C.to_f].min
    else
      [format("%.2f", E_C * (stows * E_C / (clicks.to_f + comments.to_f * E_C))).to_f,
       E_C.to_f].min
    end
  end

  def comment_revised
    if is_hot_bangumi?
      self.class.get_comment_revised clicks, comments, stows, :hot_bangumi => true
    else
      self.class.get_comment_revised clicks, comments, stows
    end
  end

  def click_point
    cp = clicks * click_revised
    cp = [[stows  * 100, 50000].max, cp].min unless is_hot_bangumi?
    cp
  end

  def self.get_click_revised_2 clicks, parts, stow , ops={}
    click_point = clicks * self.get_click_revised(parts)
    if ops[:hot_bangumi]
      self.get_click_revised(parts)
    else
     format("%.2f", [[stow  * 100.0, 50000.0].max, click_point].min / clicks).to_f
    end
  end
end

